<?php

include_once __DIR__."/../../vendor/autoload.php";

$multiProcess = new \asyncService\lib\multiProcess(5);

$multiProcess->bindParentCallback(function ($worker){
    while(1){
        echo "I am parent\n";
        sleep(1);
        if(rand(1,100) >90){
            throw new Exception();
        }
    }
});

$multiProcess->bindSubCallback(function ($worker){
    while(1){
        echo "I am sub\n";
        sleep(1);
    }
});

$multiProcess->run();